var moduleCode = getQueryString("moduleCode");
$(function () {
    $("#jqGrid").Grid({
        url: '../modulechangelog/list?moduleCode='+moduleCode,
        colModel: [
            {label: '模具号', name: 'moduleNo', index: 'MODULE_NO', width: 80},
            {label: '模具编码', name: 'moduleCode', index: 'MODULE_CODE', width: 80},
            {label: '移动人', name: 'author', index: 'AUTHOR', width: 80},
            {label: '新车间', name: 'subShopNow', index: 'SUB_SHOP_NOW', width: 80},
            {label: '原车间', name: 'subShopOld', index: 'SUB_SHOP_OLD', width: 80},
            {label: '备注信息', name: 'descn', index: 'DESCN', width: 80},
            {label: '移动时间', name: 'authorDate', index: 'AUTHOR_DATE', width: 80},
            {label: 'id', name: 'id', index: 'ID', key: true, hidden: true},
        ]
    });
});

let vm = new Vue({
    el: '#rrapp',
    data: {
        showList: true,
        title: null,
        moduleChangeLog: {
            descn: '',
            authorDate: '',
            author: '',
            subShopNow: '',
            subShopOld: '',
            moduleNo: '',
            moduleCode: '',
            id: '',
        },
        ruleValidate: {
            name: [
                {required: true, message: '名称不能为空', trigger: 'blur'}
            ]
        },
        q: {
            name: ''
        }
    },
    methods: {
        query: function () {
            vm.reload();
        },

        reload: function (event) {
            vm.showList = true;
            let page = $("#jqGrid").jqGrid('getGridParam', 'page');
            $("#jqGrid").jqGrid('setGridParam', {
                postData: {'name': vm.q.name},
                page: page
            }).trigger("reloadGrid");
            vm.handleReset('formValidate');
        },
        reloadSearch: function () {
            vm.q = {
                name: ''
            };
            vm.reload();
        },
    }
});